package com.gitee.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.gitee.entity.WareSkuEntity;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

@LocalTCC
public interface WareSkuService extends IService<WareSkuEntity> {

    @TwoPhaseBusinessAction(name = "reduct", commitMethod = "confirm", rollbackMethod = "cancel")
    void reduct(@BusinessActionContextParameter(paramName = "skuId") Long skuId,
                @BusinessActionContextParameter(paramName = "num") Integer num);

    boolean confirm(BusinessActionContext ctx);

    boolean cancel(BusinessActionContext ctx);
}
